package net.hctek.identity.action;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;

import com.opensymphony.xwork2.ActionSupport;

import net.hctek.identity.bean.Files;
import net.hctek.identity.bean.Navs;
import net.hctek.identity.service.IdentityServiceI;
import net.hctek.identity.util.ResponseJsonUtils;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

public class JsonPageDownload extends ActionSupport{

	private static final long serialVersionUID = 1L;
	@Autowired
	private IdentityServiceI identityService;
	private List<Files> pageListx = new ArrayList<>();
	
	@Override
	public String execute(){
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setHeader("Access-Control-Allow-Origin", "*");
		try {
				System.out.println(identityService.filesAll());
/*				JSONArray json = new JSONArray();
				 for(String f : pageListx){
					 	
		                JSONObject jo = new JSONObject();
		                jo.put("FileName",f.toString());
		                jo.put("FilePath",f.toString());
		                jo.put("UserName",;

		                json.add(jo);
		            }
				System.out.println(json.toString());
				ResponseJsonUtils.json(response, json);*/
		} catch (Exception e) {
			e.printStackTrace();
		}
		return NONE;
	}
}
